<?php
if (isset($InputData['list_type'])) {
    //获取专题列表 1代表广场 2关注 3参与 10我的专题 11专题选择
    if ($InputData["list_type"] == 1 || $InputData["list_type"] == 2 || $InputData["list_type"] == 3) {
        $topic_list_id = 0;
        if (isset($InputData['page_iscroll_load']) && $InputData['page_iscroll_load'] == 1) {
            $seleBarItem = $InputData['list_type'];
            $seleBarItem1 = "广场";
            $seleBarItem2 = "关注";
            $seleBarItem3 = "参与";
            $seleBarScript1 = "topic_show_list(1,1)";
            $seleBarScript2 = "topic_show_list(2,1)";
            $seleBarScript3 = "topic_show_list(3,1)";
            require("{$viewRoot}list_sele_bar{$viewEx}");
        }
        if (!isset($myTopic)) {
            require_once("{$CfgPara->root}/model/topic.m.php");
            $myTopic = new topic_m($CfgPara->database);
        }
        if (isset($InputData['page_change']) && $InputData['page_change'] > 0) {
            $page_index = $InputData['page_change'];
        } else {
            $page_index = 1;
        }
        $topicList = $myTopic->topic_list($InputData["list_type"], $topic_list_id, $page_index, $CfgPara->pagesize, null, true);
        $topicCount = $myTopic->topic_list_count;
        if (is_string($topicList)) {
            echo($topicList);
        } else {
            if ($isTablet) {
                //连接分页类 在列表最后加入分页栏
                if ($topicCount > 0) {
                    require_once("{$CfgPara->root}/class/paginate.class.php");
                    $myPaginate = new paginate_c();
                    $myPaginate->change_func = "topic_page_change({$InputData['list_type']},[x])";
                    $paginateMsg = $myPaginate->paginate($page_index, ceil($topicCount / $CfgPara->pagesize));
                }
            }
            if (isset($InputData['page_iscroll_load']) && $InputData['page_iscroll_load'] == 1) {
                if ($InputData['list_type'] == 2 && $isTablet === true)
                    require("{$viewRoot}topic_attention_list{$viewEx}");
                else
                    require("{$viewRoot}topic_show_list{$viewEx}");//如果为下拉刷新控件加载的初始化阶段 则连接整个视图
            } else {
                if ($isTablet === true) {
                    // pc使用换页的方式
                    // 关注的内容已特殊处理 需要根据提交的类型分别加载
                    if ($InputData["list_type"] == 2)
                        require("{$viewRoot}topic_attention_list_page{$viewEx}");
                    else
                        require("{$viewRoot}topic_show_list_page{$viewEx}");
                } else {
                    // 手机如果为加载/刷新内容 则仅连接内容
                    // 关注的内容已特殊处理 需要根据提交的类型分别加载
                    if ($InputData["list_type"] == 2)
                        require("{$viewRoot}topic_attention_list_content{$viewEx}");
                    else
                        require("{$viewRoot}topic_list_content{$viewEx}");
                }
            }
        }
    } else {
        echo("专题列表类型错误");
    }
}
